//
//  HDPrivateKey+Extension.swift
//  EthereumKit
//
//  Created by apple on 2018/6/1.
//  Copyright © 2018年 yuzushioh. All rights reserved.
//

import CryptoSwift

extension HDPrivateKey {
	//Helper
	private func endcode_AES(dataToEncode: Data, key: [UInt8]) -> Data {
		var result: [UInt8] = []
//		do {
//			let aes = try AES(key: Padding.zeroPadding.add(to: key, blockSize: AES.blockSize), blockMode: .ECB)
//			result = try aes.encrypt(dataToEncode.bytes)
//		} catch { }
//		
		let data = Data(bytes: result)
		
		return data
	}
	
	//  MARK:  AES-128解密
	private static func Decode_AES(dataToDecode: Data, key: [UInt8]) -> Data {
		// decode AES
		var decrypted: [UInt8] = []
		//		do {
		//			let aes = try AES(key: Padding.zeroPadding.add(to: key, blockSize: AES.blockSize), blockMode: .ECB)
		//
		//			decrypted = try aes.decrypt(dataToDecode.bytes)
		//		} catch {
		//
		//		}
		// byte 转换成NSData
		let data = Data(decrypted)
		return data
	}
}
